<template>
  <div class="chat-page">
    <dragConent>
      <div class="utils">
        <div class="titlename">哈哈哈</div>
        <toolbar @mousedown.stop @click.stop></toolbar>
      </div>
    </dragConent>

    <div>
      {{ userStore.getInfo }}
      <el-button @click="onClick">变高</el-button>
      <el-button @click="openHoverBox">出现浮动窗口</el-button>
      <el-button @click="openutils">新浮动窗口</el-button>
      <el-button @click="logOut">退出登录</el-button>
    </div>
    <div class="toolbars">
      <div class="tool-item">
        <div class="tool-list">
          <div class="disc"></div>
        </div>
      </div>
    </div>
  </div>
</template>

<script lang="ts" setup>
import dragConent from '@/components/Dragareacomponent.vue'
const toolbar = defineAsyncComponent(() => import('@/components/toolbar.vue'))
import { useUserStore } from '@/pinia/user'
const userStore = useUserStore()
const isshow = ref(false)
const onClick = () => {
  isshow.value = !isshow.value
  console.log(isshow.value)
  window.electron.ipcRenderer.send('set-window-config', {
    height: isshow.value ? 600 : 400
  })
}
const openHoverBox = () => {
  window.electron.ipcRenderer.send('hoverBox-window', '浮动')
  console.log('点击?')
}
const logOut = () => {
  window.electron.ipcRenderer.invoke('logOut-window', '退出登录')
}
const openutils = () => {
  window.electron.ipcRenderer.send('utils-window', '新浮动窗口')
}
</script>

<style scoped lang="scss">
.fla {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}
.chat-page {
}
.utils {
  @extend.fla;
  position: relative;
  width: 100%;
  height: 30px;
  background-color: #f5f5f5;
}
.titlename {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  height: 30px;
  line-height: 30px;
  padding-left: 10px;
  font-size: 14px;
  font-weight: bold;
  color: #333;
}
.toolbars {
  height: 200px;
  width: 200px;
  box-sizing: border-box;

  border: 1px solid #000;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}
.tool-item {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background-color: pink;
  position: relative;
  z-index: 12;
}
.tool-list {
  position: absolute;
  z-index: 1;
  width: 100px;
  height: 100px;
  right: 50%;
  top: 50%;
  transform: translateY(-50%);

  border: 1px solid #000;
  overflow: hidden;
}
.disc{
  width: 100%;
  height: 100%;
  background-color: red;
  border-radius: 50%;
}
</style>
